import org.junit.*;

import java.util.*;
import play.test.*;
import models.*;
public class editTutorialtest extends UnitTest{

 /**
  * This test is testing the editing of a Tutorial.
  * 
  * @author Haidy Essam
  */
 @Test
 public void tutorialTest() {
  Topic t = new Topic("Cs");
  t.save();
  RegisteredUser me = new RegisteredUser("Haidy", "haidy@gmail.com",
    "1234", false);
  Tutorial t1 = new Tutorial("java", t, "whatever","summary","java,play", "Beginner", me);
  t1.save();
  Tutorial t2 = new Tutorial("DB", t, "whatever2","summary", "blablabla",
    "Medium", me);
  t2.save();
  editVersion e1 = new editVersion(1,"java1","whatevermodified","java,play1","Medium");
  e1.save();
  t1.edits.add(e1);
  t1.setContent("haidy");
  editVersion e2 = new editVersion(1,t1.Title,t1.content,t1.getStringofwords(),t1.ExpLevel);
  e2.save();
  t1.edits.add(e2);
  List<Tutorial> tuts = Tutorial.findAll();
  assertEquals(2, tuts.size());
  assertEquals("haidy",t1.getContent());
  assertEquals("haidy",e2.getContent());
  assertNotNull(e1);
  assertNotNull(e2);
  assertNotNull(t1);
  assertNotNull(t1.getContent());
 }
 }